#!/usr/bin/env bash

BIN_NAME=gohttpproxy
if [ "$BIN_NAME" == '' ];then
   echo 'please enter BIN_NAME'
   exit
fi

rm -rf $BIN_NAME

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o ${BIN_NAME} main.go

echo "go build OK"

image_name=docker.hub.gohttpproxy:$1

docker build -t ${image_name} -f ./Dockerfile .
docker push ${image_name}